package com.boyi.core;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContextEvent;
import javax.servlet.annotation.WebListener;

/**
 * @author tingwen
 * @description 启动listener
 * @date 2019-05-23 14:34
 **/
@WebListener
public class BootStrapListener extends ContextLoaderListener {
    @Override
    public void contextInitialized(ServletContextEvent event) {
        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
        CM.setContext(context);
    }
}
